package com.kkwrite.regimen.common.constant;

/**
 * Created by lisha on 2018/7/12 15:16.
 *
 * @author lisha
 */
public enum UserLevelEnum {
    /**
     * 普通级别
     */
    LEVEL_NORMAL("普通", 1),
    /**
     * 黄金级别
     */
    LEVEL_GOLD("黄金", 2),
    /**
     * 白银级别
     */
    LEVEL_SILVER("白银", 3),
    /**
     * 钻石级别
     */
    LEVEL_DIAMOND("钻石", 4)
    ;

    private String levelName;
    private Integer levelValue;

    UserLevelEnum(String levelName, Integer levelValue) {
        this.levelName = levelName;
        this.levelValue = levelValue;
    }

    public String getLevelName() {
        return this.levelName;
    }

    public Integer getLevelValue() {
        return this.levelValue;
    }

    public static String findLevelName(int value) {
        for (UserLevelEnum levelEnum : UserLevelEnum.values()) {
            if (levelEnum.getLevelValue() == value) {
                return levelEnum.getLevelName();
            }
        }
        return UserLevelEnum.LEVEL_NORMAL.getLevelName();
    }

}
